package com.litchi.tutor.common.enums;

import cn.hutool.core.util.ObjectUtil;

/**
 * @author hoby
 * @since 2021-08-19
 */
public enum SendPurpose {
    LOGIN(0), // 登录
    RESET_PWD(1), // 重置密码
    ;

    SendPurpose(Integer code) {
        this.code = code;
    }

    private final Integer code;

    public Integer getCode() {
        return code;
    }

    public static SendPurpose getByCode(Integer code) {
        if (ObjectUtil.isEmpty(code)) {
            return null;
        }
        for (SendPurpose sendPurpose : SendPurpose.values()) {
            if (sendPurpose.getCode().equals(code)) {
                return sendPurpose;
            }
        }
        return null;
    }
}
